#define _CRT_SECURE_NO_WARNINGS 1
#include<string>
#include<iostream>
using namespace std;

#include"string.h"

void string_test1()
{
	bit::string s1("hello bit");
	cout << s1.c_str()<< endl;
	cout << s1.size() << endl;

	bit::string s2(s1);
	cout << s2.c_str() << endl;
	bit::string s3;
	s3 = s1;
	cout << s3.c_str() << endl;

	for (size_t i = 0; i < s1.size(); i++)
	{
		cout << s1[i] << " ";
	}
	cout << endl;
	auto it = s1.begin();
	while (it != s1.end())
	{
		cout << *it << "  ";
		it++;
	}
	cout << endl;
	s1.push_back('#');
	cout << s1.c_str() << endl;
	s1 += '$';
	cout << s1.c_str() << endl;
	s1.append("#");
	cout << s1.c_str() << endl;
	s1 += "kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk";
	cout << s1.c_str() << endl;
	//s1.insert(5,'n');
	//cout << s1.c_str() << endl;

}

void string_test2()
{
	bit::string s1("kkkkkk");
	cout << s1.c_str() << endl;
	s1.insert(5, 'n');
	cout << s1.c_str() << endl;

}

void string_test3()
{
	bit::string s1("kkkkkk");
	cout << s1.c_str() << endl;
	s1.insert(5, "bitbitbitttttttttttttttttttttttt");
	cout << s1.c_str() << endl;

}

void string_test4()
{
	bit::string s1("0123456789");
	cout << s1.find("6", 3) << endl;
	cout << s1.find("456", 3) << endl;
	s1.erase(5,2);
	cout << s1.c_str() << endl;

}

void string_test5()
{
	bit::string s1("0126");
	bit::string s2("0129");
	//s1.resize(100, '0');

	cout << (s1 < s2) << endl;
	cout << (s1 <= s2) << endl;
	cout << (s1 > s2) << endl;
	cout << (s1 >= s2) << endl;
	cout << (s1 == s2) << endl;
	cout << (s1 != s2) << endl;
	s1.swap(s2);
	cout << s1.c_str() << endl;
}

void test_string9()
{
	bit::string s1("hello");
	bit::string s2(s1);

	cout << s1 << endl;
	cout << s2 << endl;

	bit::string s3("xxxxxxxxxxxxx");
	s1 = s3;

	cout << s1 << endl;
	cout << s3 << endl;
	cin >> s1;
	cout << s1 << endl;

}

int main()
{
	test_string9();

	return 0;
}